package com.hq.controller;

import com.hq.bean.User;
import com.hq.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class UserController {

    @Resource
    private UserService userService;
    @RequestMapping("list.do")
    public  String list(Model model){
        List<User>list=userService.list();
        model.addAttribute("list",list);
        return "list";
    }
    @RequestMapping("del.do")
    @ResponseBody
    public  Object del(Integer id){
        int i=userService.del(id);
        return i;
    }
}
